package com.scau.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.scau.dao.Impl.SectionDaoImpl;
import com.scau.pojo.Section;
import com.scau.pojo.Video;
import com.scau.service.SectionService;
@Service
public class SectionServiceImpl implements SectionService{
	@Autowired
	SectionDaoImpl sectionDAO;

	@Override
	public List<Section> query() {
		return sectionDAO.query();
	}

	@Override
	public int update(JSONObject jsonObject) {
		int result=0;
		Section section=new Section();
		int seId=jsonObject.getInteger("seId");
		String seName=jsonObject.getString("seName");
		int tId=jsonObject.getInteger("tId");
		int seSeq=jsonObject.getInteger("seSeq");
		String sePpt=jsonObject.getString("sePpt");
		section.setSeName(seName);
		section.setSeId(seId);
		section.settId(tId);
		section.setSeSeq(seSeq);
		section.setSePpt(sePpt);
		try {
			result=sectionDAO.update(section);
			
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
		return result;
	}

}
